<!DOCTYPE HTML>
<title>Ensure that globalAlpha is applied correctly to text.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<script>
test(function() {
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = "black";
    ctx.globalAlpha = 0.5;
    ctx.font = "50px Arial";
    ctx.fillText("A",50,50);
    var imageData = ctx.getImageData(63, 22, 1, 1).data;
    var expectedValue = [127, 128];
    assert_in_array(imageData[3], expectedValue);
});
</script>